/**
 * 高德地图, 办公地点
 */
import React from 'react';
import { Spin, Row } from 'antd';
import { Map as GDMap, Marker } from 'react-amap';
import { AMAP_KEY } from '@/pages/Attendance/Setting/config';

const Map = ({ defaultPosition }) => {
    const loadingComponent = (
        <Row type="flex" justify="center" align="middle" style={{ height: '100%' }}>
            <Spin />
        </Row>
    );
    return (
        <GDMap amapkey={AMAP_KEY} center={defaultPosition} loading={loadingComponent} plugins={['ToolBar']} zoom={14}>
            {defaultPosition && <Marker position={defaultPosition} />}
        </GDMap>
    );
};

export default Map;
